Page({
  data: {
    is_login:false,
    customer:[],
    loadingHidden: false,
    expiration_time:"",
  },

  onLoad: function (options) {
    // 页面初始化 options为页面跳转所带来的参数
    //加载最新
  },

  /**
  * 请求数据
 **/
  requestData: function (customer_id) {
    var that = this;
    wx.request({
      url: getApp().globalData.ADMIN_API_HOST +'/customer?1=1',
      data: {
        customer_id: customer_id,
      },
      method: 'GET',
      success: function (res) {
        that.setData({
          loadingHidden: true,
          customer: res.data,
          expiration_time: res.data.expiration_time.substr(0,10),
        })
      }
    })
  },

  phoneCall:function(){
    wx.makePhoneCall({
      phoneNumber: '02154590625',
    })
  },

  outLoginBtn:function(){
    getApp().outLoginWithData();
    this.setData({
      is_login: false,
      customer: [],
      loadingHidden: false,
      expiration_time: "",
    })
    wx.switchTab({
      url: '../course/course',
    })
  },

  onShow: function () {
    // 页面显示
    if (!getApp().isLogin()) {
      wx.navigateTo({
        url: '../login/login',
      })
    } else {
      this.requestData(getApp().globalData.customer.id);
      this.setData({
        is_login: true,
      })
    }
  },

  // 获取输入用户名  
  usernameInput: function (e) {
    this.setData({
      username: e.detail.value
    })
  },

  // 获取输入密码  
  passwordInput: function (e) {
    this.setData({
      password: e.detail.value
    })
  },

  

})   